﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using StyleMVVM.DependencyInjection;

namespace StyleMVVM.LanguageExtensions
{
	internal static class InternalDIExtensions
	{
		internal static T Locate<T>(this IDependencyInjectionContainer container)
		{
			return (T)container.LocateByType(typeof(T));
		}

		internal static IEnumerable<T> LocateAll<T>(this IDependencyInjectionContainer container)
		{
			List<T> returnValue = new List<T>();

			foreach (object o in container.LocateAllByType(typeof(T)))
			{
				if (o is T)
				{
					returnValue.Add((T)o);
				}
			}

			return returnValue;
		}
	}
}